%BIIS2006_3HW3
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%DUE 11:59AM, Tuesday April 17th
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function contrastNorm = contrast(imgray);

dmgray = im2double(imgray);
%Display image with title YellowSpider, use figure to open new window for
%EVERY image in this homework assignment

%Create DoG filters, 8x8 and 32x32
%Use your function that you developed for last HW assignment
%Parameters:
%DoG8: image size 8x8, 
%sigmaex = .04
%sigmainh = .16
%FirstTerm = 6.0
%SecondTerm = 1.0
%filterScale = .41

%DoG32: imageSize  32;
%sigmaex = .05
%sigmainh = .15
%FirstTerm = 7.0
%SecondTerm = 1.0
%filterScale = .06

dog8 = DoG(8, 0.04, 0.16, 6.0, 1.0, 0.41);
dog32 = DoG(32, 0.05, 0.15, 7.0, 1.0, 0.06);

%Display plots of the DoG filters, label Dog8 and Dog32
%(extract row of data from the center of the DoG filter. 

%continuing:
%Convolve the grayscale image with each DoG filter and take absolute value
%Display the Contrast images, label as im8Contrast and im32Contrast

im8 = conv2(dmgray, dog8, 'same');
im8 = abs(im8);
im32 = conv2(dmgray, dog32, 'same');
im32 = abs(im32);

contrast = (im8 + im32);
contrastNorm = mat2gray(contrast);
